<div class="layui-fluid protocol-info"  lay-title="协议" id="app-vue">

    <div class="layui-row layui-col-space10">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <form class="layui-card-header layuiadmin-card-header-auto" >
                        <el-button @click="handleSubmit">保存</el-button>
                    </form>
                    <div class="layui-card-body nepadmin-pad-l10 nepadmin-pad-r10">

                    <el-form ref="form" label-width="120px">

                        <el-form-item label="内容" prop="content">
                            <my-ue-editor :content="content" ref="myWangEditor"/>
                        </el-form-item>

                    </el-form>

                </div>
            </div>
        </div>
    </div>
</div>
<script>
layui.extend({
    myUeEditor: 'views/components/myUeEditor',
}).use(['admin','conf','jquery','view','myUeEditor'], function (admin,conf,$,view,myUeEditor) {
    var page_param = admin.route.search
    var type = page_param.type||''
    console.log(page_param,admin.route)
    let window_key = "protocol-"+type
    $(".protocol-info").addClass(window_key)
    var app = new Vue({
        el: '#app-vue',
        data: {
            table_loading:false,
            editor:null,
            content:'',
            listQuery:{

            }
        },
        created: function () {
            this._initData()
        },
        components:{
            "my-ue-editor":myUeEditor,
        },
        mounted:function(){
        },
        methods: {
            _initData: function (is_reset) {
                if (is_reset === true) {

                }
                const that = this
                //开启table加载效果
                this.table_loading = true
                admin.post({
                    url: '/admin/system/setting'
                    , data:{type:type}
                    , success: function (res) {
                        var data = res.data || {}
                        const content = data.content || " "
                        // that.content = content
                        that.$refs['myWangEditor'].setContent(content)
                    }
                    , complete: function () {
                        console.log('complete')
                    }
                })
            },


            handleSubmit:function(){
                const that = this
                admin.post({
                    url:'/admin/system/settingSave',
                    data:{
                        type:type,
                        content: this.$refs['myWangEditor'].getContent()
                    },
                    success:function(res){
                        const data = res.data||{}
                        that.$message({ message: res.msg, type: 'success' });

                    }
                })
            }
        }
    })
})

</script>